<?php

class SystemProperties{
	public static $api_key;
	public static $secret;

	public static $app_host;
	public static $app_host_webroot;
	public static $app_url;
	public static $path;
	public static $path_js;
	public static $game_redirect_path;
	public static $app_upload_img_host;

	public static $img_names=array('g_img','g_img_small_one','g_img_small_two','g_img_small_three','g_img_small_four','g_img_small_five');
	public static $app_title = "开心赚宝";
	public static $user_pageNumber=12;
	public static $user_top_number=10;


	//收藏屋列表
	public static $item_pageNumber=6;

	//消息列表
	public static $messageNumber=10;


	/* ===== 免费派宝 ============= */

	//申领失败的提示信息
	public static $apply_failure= array('1'=>'请默念人品瞬间提升咒语“人品换奖品要奖品不要人品”三百遍，下次就会成功！','2'=>'马克思爷爷说过，量变产生质变，只要您努力下次一定会成功的！','3'=>'留得青山在，不怕没柴烧！下次机会多着呢！','4'=>'奖品不在仁义在，大侠请稍后再试！','5'=>'看来你的运气已经严重透支，下次再试吧！');

	//首页 免费 和 半价产品 商店列表显示个数
	//产品列表  ： 一页显示10条记录 ，免费和半价 都是 2行5列
	public static $product_pageNumber=9;
	public static $product_half_pageNumber=6;

	//积分兑换 列表 显示个数
	//积分列表 ：一页显示 20 条记录 ， 4行5列
	public static $convert_pageNumber=12;

	//信息统计-兑换历史记录列表显示个数
	//信息统计 ：试用和兑换 都是 一页显示 15 条记录。3行5列
	public static $historyNumber=8;

	// try_help_tab_1 关于申领
	public static $try_help_tab_apply_id=1;
	// try_help_tab_2 关于兑换
	public static $try_help_tab_convert_id=2;
	// try_help_tab_3 常见Q&A
	public static $try_help_tab_qa_id=3;
	
	//
	public static $platform='renren';
	public static $admin_uid=-100;
	public static $platform_logo='';

	//只能申请一次的产品ID
	public static $only_once_product=array();
	public static $UPLOAD_ROOT_PATH = '/opt/www/img_upload_user/';
	
	public static $paterner_class=array(
	'pig'=>2,
	'rongame'=>3,
	'ppy'=>4,
	'car_27beffd1'=>5,
	'car_bef370a2'=>6,
	'car_20e42fd3'=>7,
	'car_fd66d1b4'=>8,
	
	'wa_123kj1b1'=>9,
	'wa_ldkjfsa2'=>10,
	'wa_sjadkfs3'=>11,
	'wa_eofjwoi4'=>12,
	
	'mowang_dsfadfj1'=>13,
	'mowang_sadfiop2'=>14,
	'mowang_oweiopw3'=>15,
	'mowang_jiojfwe4'=>16,
	
	'daozhu'=>19,
	'lou'=>20,
	
	'w'=>18,
	); //1。配合修改索引 2。 product_contr 215行
	public static $catname = array(
	0=>'--',
	1=>'旅游',
	2=>'开心猪倌',
	3=>'荣光医院',
	4=>'泡泡鱼',
	5=>'汽车工厂',
	6=>'汽车工厂',
	7=>'汽车工厂',
	8=>'汽车工厂',
    9=>'快来挖Wa',
	10=>'快来挖Wa',
    11=>'快来挖Wa',
	12=>'快来挖Wa',
	13=>'魔王名单',
	14=>'魔王名单',
	15=>'魔王名单',
	16=>'魔王名单',	
	
	18=>'w',	
	19=>'快乐岛主',
	20=>'楼一幢',
	-1=>'X',
	);	
	public static function init(){

		$hostname = $_SERVER['HTTP_HOST'];
		// for 'renren.try888.cn' or ip
		self::$app_url="http://apps.renren.com/icantry";
		self::$api_key = "abc911996a814e44912c69399997d729";
		self::$secret = "c4fae049c4b64b9d8a3f6d12a71e6b79";
		self::$platform = 'renren';
		self::$admin_uid = 298825783;
		self::$platform_logo = 'http://s.xnimg.cn/imgpro/logo/viplogo-renren.png';

		switch ($hostname) {
			case 'myspace.try8.info':{
				self::$app_url="http://opapps.myspace.cn/icantry";
				self::$api_key = "03686696c5fe862053fb99ddb47dea99";
				self::$secret = "648919a5b631b3f927baf5d25bb6a51c";
				self::$platform = 'myspace';
				self::$admin_uid = 1311307572;
				self::$only_once_product = array(441);
				self::$platform_logo = 'http://xfiles.cdnmyspace.cn/dir/header/v2/img/lg3.gif';
				break;
			}
			case 'localhost':
			case 'yoka.try8.info':{
				self::$app_url="http://space.yoka.com/plugin/plugin.php?appkey=10004";
				self::$api_key = "10004";
				self::$secret = "fe2cd4849f9a0b873c364245e98d3af2";
				self::$platform = 'yoka';
				self::$admin_uid = 2517270;
				self::$only_once_product = array(454,457);
				self::$platform_logo = 'http://images.yoka.com/pic/div/2010/newhead/logos.jpg';
				break;
			}

			case 'sina.try8.info':
				#self::$app_url="http://sina.try8.info/";
				self::$app_url="http://apps.weibo.com/happy_try";

				self::$api_key = "3143244534";
				self::$secret = "d22bd1f810fc3b95b246ffcd5afb117f";

				#self::$api_key = "3568729548";
				#self::$secret = "d85f66e2cb42de5a10504ccff9eb144b";
				
				self::$convert_pageNumber = 9;

				self::$platform = 'sina';
				self::$admin_uid = 1866189800;
				//self::$admin_uid = 1850114863;
				self::$only_once_product = array();
				self::$platform_logo = 'http://timg1.sjs.sinajs.cn/platformstyle/images/app/logo.png';
				break;
			case 'test.try8.info':
				self::$app_url="http://apps.renren.com/apptestv";
				self::$api_key = "14d7468425b24649bce4b9a29a449781";
				self::$secret = "ff8cfb14791f4aee9a09ddfdb81fe692";

				break;
			case 'renren.try8.info':
				self::$convert_pageNumber = 9;
				break;
			    
			default: {
				break;
			}
		}
		self::$app_host = "http://{$hostname}/";
		self::$app_host_webroot = "http://{$hostname}/webroot/";
		self::$path="http://{$hostname}/webroot/2010/";
		self::$path_js="http://{$hostname}/webroot/";
		self::$game_redirect_path= "http://{$hostname}/user/index";
		self::$app_upload_img_host = "http://{$hostname}/webroot/pic.php?u=";
	}
	
	public function get_profile_url($uid){
		switch (self::$platform){
			case 'renren':
				return 	"http://renren.com/profile.do?id={$uid}";
			case 'myspace':
				return 	"http://myspace.cn/{$uid}";
			case 'yoka':
				return 	"http://space.yoka.com/{$uid}";
			case 'sina':
				return 	"http://t.sina.com.cn/{$uid}";
		}
		return '';
	}
	/**
	 * 等级
	 *
	 * @param unknown_type $user
	 * @return unknown
	 */
	public function getUserLevelInfo($user) {
	    $day = intval($user['g_active_day']);
	    if ($day<50) {
	        return array('level'=>'铜钱', 'apply'=>3);
	    } else if ($day < 100) {
	        return array('level'=>'白银', 'apply'=>4);
	    } else if ($day < 150) {
	        return array('level'=>'黄金', 'apply'=>5);
	    } else {
	        return array('level'=>'铂金', 'apply'=>6);
	    }
	}
}

SystemProperties::init();
